package jpa.entitys.promis.construction;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the PAYMENT_REQUEST_HEADER database table.
 * 
 */
@Embeddable
public class PaymentRequestHeaderPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(unique=true, nullable=false, length=2)
	private String company;

	@Column(unique=true, nullable=false, length=30)
	private String project;

	@Column(name="REQUEST_TYPE", unique=true, nullable=false, length=2)
	private String requestType;

	@Column(name="REQUEST_SERIES", unique=true, nullable=false, length=4)
	private String requestSeries;

	@Column(name="REQUEST_NO", unique=true, nullable=false, precision=6)
	private long requestNo;

    public PaymentRequestHeaderPK() {
    }
	public String getCompany() {
		return this.company;
	}
	public void setCompany(String company) {
		this.company = company;
	}
	public String getProject() {
		return this.project;
	}
	public void setProject(String project) {
		this.project = project;
	}
	public String getRequestType() {
		return this.requestType;
	}
	public void setRequestType(String requestType) {
		this.requestType = requestType;
	}
	public String getRequestSeries() {
		return this.requestSeries;
	}
	public void setRequestSeries(String requestSeries) {
		this.requestSeries = requestSeries;
	}
	public long getRequestNo() {
		return this.requestNo;
	}
	public void setRequestNo(long requestNo) {
		this.requestNo = requestNo;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof PaymentRequestHeaderPK)) {
			return false;
		}
		PaymentRequestHeaderPK castOther = (PaymentRequestHeaderPK)other;
		return 
			this.company.equals(castOther.company)
			&& this.project.equals(castOther.project)
			&& this.requestType.equals(castOther.requestType)
			&& this.requestSeries.equals(castOther.requestSeries)
			&& (this.requestNo == castOther.requestNo);

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.company.hashCode();
		hash = hash * prime + this.project.hashCode();
		hash = hash * prime + this.requestType.hashCode();
		hash = hash * prime + this.requestSeries.hashCode();
		hash = hash * prime + ((int) (this.requestNo ^ (this.requestNo >>> 32)));
		
		return hash;
    }
}